package com.codefish.framework.spring.core.utils;

/**
 * @author <a href='https://gitee.com/hzf2281'>codefish</a>
 * @version 1.0.0
 * @since 2022/09/23 下午 09:31
 */
public abstract class StringUtils {
    public static boolean isEmpty(CharSequence string) {
        return string == null || string.length() == 0;
    }

    /**
     * 从classPathURI提取classpath,例如
     * <pre>
     *    classpath:foo/bar/a.txt =>  foo/bar/a.txt
     *    classpath:/foo/bar/a.txt =>  foo/bar/a.txt
     * </pre>
     *
     * @param classPathURI classPathURI
     * @return classpath
     */
    public static String getClassPath(String classPathURI) {
        String uri = classPathURI.substring(classPathURI.indexOf(":") + 1);
        if(uri.startsWith("/")) {
            uri = uri.substring(1);
        }
        return uri;
    }


}
